export const getConnectInfo = (
  uiLayoutInfo: Record<string, string | number>
): Record<string, string | number> => {
  const connectInfo: Record<string, string | number> = {
    schema: "ssh",
    port: "0",
  };
  connectInfo.schema = uiLayoutInfo.uiLayout;
  connectInfo.port = uiLayoutInfo.port;
  return connectInfo;
};

export const reExecution = (Fun: () => any, times = 0, timeOut?: number) => {
  const initTimeOut = timeOut || 18000;
  let tOut = initTimeOut - times * 1000 > 0 ? initTimeOut - times * 1000 : 1000;
  times === 1 && (tOut = 3000);

  setTimeout(() => {
    Fun();
  }, tOut);
  if (tOut === 1000) return 0;
  return times;
};
